<?php
/**
 * Created by PhpStorm.
 * User: jacob
 * Date: 18-10-16
 * Time: 下午5:11
 */
namespace Common;

class Logger{
  const trace = 0;
  const debug = 1;
  const info  = 2;
  const warn  = 3;
  const error = 4;
  const fatal = 5;

  private static $_instance;

  private function __construct() {
  }

  public static function getInstance(){
    if (!self::$_instance instanceof self){
      self::$_instance = new Logger();
    }
    return self::$_instance;
  }

  public function trace(){

  }

  public function debug(){

  }

  public function info(string $message,\Throwable $e = null){
    $msg = "[Info]";
    if ($e != null){
      $msg .= "Throwable message is :".$e->getMessage();
    }
    $msg .= $message.PHP_EOL;
    file_put_contents(\LoggerConfig::PATH,$msg,FILE_APPEND);
  }

  public function warn(){

  }

  public function error(){

  }

  public function fatal(){

  }
}